package org.openkanban.client.ui.presenter;

import org.openkanban.client.util.RootPanel;
import org.openkanban.shared.dto.BoardDto;

import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.RequestCallback;
import com.google.gwt.http.client.Response;

/**
 * Callback that handles get board by id request
 */
public class GetBoardByIdRequestCallback implements RequestCallback {

    @Override
    public void onError(Request request, Throwable exception) {

    }

    @Override
    public void onResponseReceived(Request request, Response response) {
	BoardDto boardDto = new BoardDto(response.getText());
	RootPanel.main.getBoard().getCurrentBoardNameLabel().setContents(boardDto.getBoardName());
	RootPanel.main.getBoard().getWhiteBoardView().setBoardDto(boardDto);
    }
}
